
package com.hlkj.pay.vo.order.req;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

import com.hlkj.framework.common.valid.EnumValid;
import com.hlkj.framework.common.valid.HttpHttpsURL;
import com.hlkj.framework.common.valid.ValidAmount;
import com.hlkj.pay.enums.CommonEnum;
import com.hlkj.pay.enums.PayEnums;
import com.hlkj.pay.enums.PayOrderEnums;
import com.hlkj.pay.vo.BaseReq;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * @author HlpayTeam
 * @date 2024/10/09 11:37
 */
@Data
public class PayOrderCommonParamReq extends BaseReq {

    @Schema(description = "支付类型 WECHAT: 微信 ALIPAY: 支付宝 UNION_APY: 云闪付 DIGITAL: 数字人民币")
    @NotEmpty(message = "支付类型 不能为空")
    private String payType;

    @Schema(description = "支付方式 NATIVE- 扫码支付； SCAN- 反扫支付；JSAPI-微信JSAPI、支付宝JSAPI支付、银联JSAPI支付； SIMPLE-简易支付 MINI_APP-微信小程序支付、支付宝小程序支付 H5-h5 支付 APP-APP 支付")
    @NotEmpty(message = "支付方式 不能为空")
    private String paySubType;

    @Schema(description = "场景类型 1 线下 2 线上 不传默认线下")
    @EnumValid(value = PayEnums.SCENE_TYPE.class,message = "场景类型 无效")
    private Integer sceneType;

    @Schema(description = "服务商编码 不传随机路由")
    private String providerCode;

    @Schema(description = "通道编码 不传随机路由")
    private String channelCode;

    @Schema(description = "子通道code 不传随机路由")
    private String mchChannelCode;

    @Schema(description = "商户订单号 规则 英文字符,数字,_")
    @NotEmpty(message = "商户订单号 不能为空")
    @Size(max = 64, min = 10)
    private String mchOrderNo;

    @Schema(description = "订单金额 单位元")
    @NotEmpty(message = "订单金额 不能为空")
    @ValidAmount(message = "订单金额无效")
    private String amount;

    @Schema(description = "买家ip")
    @NotEmpty(message = "买家ip 不能为空")
    private String clientIp;

    @Schema(description = "商品标题")
    @NotEmpty(message = "商品标题 不能为空")
    @Size(max = 32)
    private String subject;

    @Schema(description = "商品描述")
    @Size(max = 256)
    private String description;

    @Schema(description = "特殊支付通道额外参数")
    private Extra extra;

    @Schema(description = "支付结果异步通知地址")
    @HttpHttpsURL
    private String notifyUrl;

    @Schema(description = "跳转地址")
    private String redirectUrl;

    @Schema(description = "订单过期时间 不传默认30分钟 单位秒")
    private Integer expiredTime;

    @Schema(description = "分账类型 ，0或空=无分账，1=实时分账，2=延时分账，3=商户 预设默认分账")
    private Integer fundProcessType;

    @Schema(description = "分账接收方")
    @Valid
    private List<OrderAccount> acctInfos;

    @Schema(description = "易生营销信息")
    private List<MarketingOrdersReq> marketingOrders;

    /**
     * @see PayOrderEnums.PAY_ORDER_SUBSIDY_TYPE
     */
    @Schema(description = "营销补贴类型 ，0或空=无营销，1=自定义金额立减，2=自定义金额补贴，3=代金券 4=满减券")
    private Integer marketProcessType;

    @Schema(description = "营销补贴信息")
    private OrderPromotionInfo marketInfo;

    @Data
    public static class Extra {

        @Schema(description = "微信侧商户appid，微信公众号或者微信小程序appid")
        private String subAppid;
        @Schema(description = "应用名称 h5支付的时候传")
        private String appName;
        @Schema(description = "是否原生支付 0 否 1 是 默认是")
        private Integer originalType= CommonEnum.YES_NO_TYPE.YES.getCode();

        @Schema(description = "用户openid，微信公众号/小程序,支付宝小程序/生活号原生支付必填")
        private String userId;

        @Schema(description = "授权支付码")
        private String authCode;
        @Schema(description = "京东白条用户贴息:0,京东白条商户贴息:1")
        private Integer jdbtType=0;

        @Schema(description = "银联地区码")
        private String areaInfo;

        @Schema(description = "网关支付类型 1=个人网关，2=企业网关")
        private Integer limitPayType;

        @Schema(description = "校验模式 1=固定账户号+动态附言模式 2=动态账户号模式")
        private Integer checkType;

        @Schema(description = "支付宝花呗贴息类型 0=用户贴息 1=商户贴息")
        private Integer hbFqFeeType=0;
        @Schema(description = "支付宝花呗分期类型 1=3期 2=6期 3=12期")
        private Integer hbFqType;
    }

}
